package com.cmeizu.webconfigdemo.config;

import com.cmeizu.webconfigdemo.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author cmeizu
 * @date 2022/1/14 11:41 PM
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //排除swagger文档路径
                .excludePathPatterns("/swagger-ui.html", "/swagger-resources/**", "/webjars/**");
    }
}
